		<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="js/jquery.xml2json.pack.js"></script> 	
<script>


var phExt = {
			timer:null,
			log: function(str){
				//alert(str);
			},
			uid: function(){
				return localStorage.getItem('uid');
			},
			init: function(){
				this.log('init');
				this.getUserKey();
				this.timer=setInterval("phExt.getData();",1000*60*15);
				this.getPublicData();
			},
			getData: function(){
				this.getMy();
				this.getFavorites();
				this.getUserInfo();
				this.getPublicData();
			},
			getPublicData: function(){
				this.getTop();
			},
			getUserKey: function(){
				$.get("http://www.photosight.ru/", function(data){
					try
					{
						var rx = /member(\?.*?)\"/gi;
						var rx_m =  rx.exec(data);
						if( rx_m.length>1)
						{	
							var uid =  rx_m[1];
							if (uid)
							{
								phExt.log(uid);
								localStorage.setItem('uid', uid);
								phExt.getData();
							}
						} else {
							setTimeout("phExt.getUserKey();",1000*10);
						}
					} catch(e){
						setTimeout("phExt.getUserKey();",1000*10);
						this.log(e);
					}
				});
			},
			
			getMy: function(){
				$.ajax({
					url: 'http://www.photosight.ru/notifier/photos' + this.uid(),
					dataType: "text",
					success: function(data){
						localStorage.setItem('xmlMy', data);
					}	
				});
			},
			getFavorites: function(){
				$.ajax({
					url: 'http://www.photosight.ru/notifier/favourite_authors_photos' + this.uid(),
					dataType: "text",
					success: function(data){
						localStorage.setItem('xmlFavorites', data);
					}	
				});
			},
			getTop: function(){
				$.ajax({
					url: 'http://www.photosight.ru/rss/top_50/',
					dataType: "text",
					success: function(data){
						localStorage.setItem('xmlTop', data);
					}	
				});
			},
			getUserInfo: function()
			{
				$.ajax({
					url: 'http://www.photosight.ru/notifier/member' + this.uid(),
					dataType: "text",
					success: function(data){
						localStorage.setItem('xmlMember', data);
					}	
				});			
			}
}
phExt.init();

</script>